<h3>My orders</h3>
<table class="table">
  <thead>
    <tr>
      <th>Order ID</th>
      <th>Order date</th>
      <th>Total price</th>
      <th>Product Lists</th>
      <th>Paid or No</th>
      <th>Cancel?</th>
      <th>Options</th>
    </tr>
  </thead>
  <tbody>
    <% @orders.each do |order| %>
    <tr>
      <td> <%= order.token %> </td>
      <td> <%= order.created_at %> </td>
      <td> <%= order.total %> CNY </td>
      <td> <%= order.product_lists.count %> </td>
      <td> <%= order.is_paid? ? "Yes" : "No" %> </td>
      <td> <%= order.apply_cancel ? "Applied" : "Not" %> </td>
      <td> <%= link_to "Show", order_path(order.token)  %> </td>
      <% if (order.order_placed? || order.is_paid?) && !order.apply_cancel %>
      <td> <%= link_to "Apply Cancel", apply_to_cancel_order_path(order.token), method: :post %> </td>
      <% end %>
    </tr>
    <% end %>
  </tbody>
</table>
